Skip to content

fix(tests): power-cycle helper must run on Python 3.6, which CI uses - #38

Merged
BitHighlander merged 1 commit into
masterfrom
fix/715-py36-power-cycle
Aug 21, 2026
Merged

fix(tests): power-cycle helper must run on Python 3.6, which CI uses#38
BitHighlander merged 1 commit into
masterfrom
fix/715-py36-power-cycle

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

The two power-cycle lifetime tests kept failing in CI after being taught to skip — and the skip was never the problem:

_emulator_process() -> subprocess.run(..., capture_output=True, text=True)
TypeError: __init__() got an unexpected keyword argument 'capture_output'

capture_output= and text= are Python 3.7+. The CI python-keepkey container runs 3.6, so the helper raised inside subprocess before any of its own logic — including the skip added last commit — could run. Locally it passed because this machine runs 3.10.

Replaced all three uses with stdout=/stderr=PIPE plus universal_newlines, which 3.6 and 3.10 both understand, and recorded why in the docstring so nobody "modernises" it back.

Also: a missing lsof now returns None instead of raising. Same situation as a remote emulator — the harness cannot identify the process, let alone restart it — so it belongs on the skip path, not the failure path. A green tree should not go red because a container lacks a tool.

Worth stating for the next person: this failure was invisible locally in every run, and the previous fix looked correct precisely because it was tested on the wrong interpreter. The environment is part of the test.

Local (3.10, harness owns the emulator): 6/6, both power-cycle tests executing rather than skipping.

The two power-cycle lifetime tests kept FAILING in CI after being taught to
skip, and the skip was never the problem:

    _emulator_process() -> subprocess.run(..., capture_output=True, text=True)
    TypeError: __init__() got an unexpected keyword argument 'capture_output'

`capture_output=` and `text=` are Python 3.7+. The CI python-keepkey container
runs 3.6, so the helper raised inside subprocess before any of its own logic --
including the skip added last commit -- could run. Locally it passed because
this machine runs 3.10.

Replaced all three uses with stdout=/stderr=PIPE plus universal_newlines, which
3.6 and 3.10 both understand, and recorded why in the docstring so nobody
"modernises" it back.

Also: a missing lsof now returns None instead of raising. That is the same
situation as a remote emulator -- the harness cannot identify the process, let
alone restart it -- so it belongs on the skip path, not the failure path. A
green tree should not go red because a container lacks a tool.

Worth stating for the next person: this failure was invisible locally in every
run, and the previous fix looked correct precisely because it was tested on the
wrong interpreter. The environment is part of the test.

Local run (Python 3.10, harness owns the emulator): 6/6, both power-cycle tests
executing rather than skipping.
@BitHighlander
BitHighlander merged commit ba05282 into master Aug 21, 2026
2 of 5 checks passed
@BitHighlander
BitHighlander deleted the fix/715-py36-power-cycle branch August 21, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant